<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Vue 模板</title>
  <script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
  <style>
    .box {
      border: 1px solid red;
      margin-bottom: 50px;
      padding-bottom: 20px;
      padding-left: 10px;
    }
    .tip {
      color: red;
    }
    .hasactive {
      border: 1px solid blue;
    }
    .green-class {
      color: green;
    }
  </style>
</head>
<body>
  <!-- 主控区域 -->
  <div id="app">
    <h1>class & style 绑定</h1>
    <div class="box">
      <h3>绑定class</h3>
      <p :class="{hasactive: isActive, 'green-class': isActive}">绑定成功，border为蓝色</p>
    </div>
    <div class="box">
      <h3>数组绑定class</h3>
      <p :class="[vactive, vgreenclass]">绑定成功，border为蓝色,字体为绿色</p>
    </div>
    <div class="box">
      <h3>style 绑定</h3>
      <p>
        <div :style="{ color: activeColor, fontSize: fontSize + 'px' }"> 颜色为红，字体大小为30</div>

      </p>
    </div>
  </div>
  
  <script>
    var vue = new Vue({
      el: "#app",
      data: {
        isActive: true,
        vactive: 'hasactive',
        vgreenclass: 'green-class',
        activeColor: 'red',
        fontSize: 30
      }
    })
  </script>
</body>
</html>